package com.xm.servlet.background.after_sales;

import com.xm.entity.AfterSales;
import com.xm.service.background.AfterSalesService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 售后Servlet
 * @author 陈盼
 * @date 2023-12-28 上午 09:10
 */
@WebServlet("/background/get/after/sales")
public class GetAfterSalesServlet extends HttpServlet {
    private final AfterSalesService service = new AfterSalesService();
    @SneakyThrows(Exception.class)
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)  {
        resp.setContentType("text/html;charset=utf-8");
        List<AfterSales> afterSalesList = service.getAll();
        System.out.println(afterSalesList);
        req.setAttribute("afterSalesList",afterSalesList);

    }
}
